import 'package:flutter/material.dart';
import 'package:flutter_ahj_app/base/pluglin/ZhiBoUtils.dart';
import 'package:flutter_ahj_app/base/utils/JUIKit/ChannelPlugin.dart';
import 'package:flutter_ahj_app/base/utils/JUIKit/JFlatButton.dart';
import 'package:flutter_ahj_app/base/utils/JUIKit/JText.dart';
import 'package:flutter_ahj_app/base/utils/mTopBar.dart';
import 'package:webview_flutter/webview_flutter.dart';

class TestPage extends StatefulWidget {
  @override
  _TestPageState createState() => _TestPageState();
}

class _TestPageState extends State<TestPage> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
      appBar: MTopBar(
        title: "我的",
        centerTitle: true,
      ).create(),
      body: WebView(
        initialUrl: "https://www.jianshu.com",
//        javascriptMode: JavascriptMode.unrestricted,
//        ///判断是拦截的URL
//        navigationDelegate: (NavigationRequest request){
//
//          if(request.url.startsWith("https://www.baidu.com")){
//
//            return NavigationDecision.prevent;
//          }
//
//          return NavigationDecision.navigate;
//        },
      )

          //_bodyView(),
    ));
  }

  _bodyView() {
    return Center(
      child: FlatButton(
          onPressed: () => _flutterToNav(),
          child: JText("调用原生直播")
      ),
    );
  }
  ///按钮事件
  _flutterToNav() async {

    ZhiBoUtils.openZhibo({});

  }

}
